<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
		<title>汀汀新能源福彩兑奖</title>
		<link rel="icon" href="__ADDONSTATIC__/home/img/bitbug_favicon.ico" type="image/gif">
		<link rel="stylesheet" href="__ADDONSTATIC__/home/css/standard.css" />
		<script src="__ADDONSTATIC__/home/js/jquery-3.5.1.js"></script>
		<script src="__ADDONSTATIC__/home/js/mui.min.js"></script>
		<link rel="stylesheet" href="__ADDONSTATIC__/home/css/mui.min.css">
		{:hook('Jssdk')}
	</head>
	<style type="text/css">
		
		.top{
			height: 3.0rem;
			width: 100%;
			background-color: rgb(136, 191, 56);
		}
		.serach{
			width: 100%;
			height: 3.0rem;
			line-height: 3.0rem;
			color: #FFFFFF;
		}
		.cter{
			align-items: center;
		}
		.section-8{
			width: 95%;
			height: 30.8rem;
			background-color: white;
			border-radius:0 0 0.625rem 0.625rem;
			margin: 0 auto;
			overflow-y: hidden;
		}
		.cter{
			align-items: center;
		}
		#tips{width: 100%;text-align: center;padding: 10px;}
		.myInfoHide{display: none;}
		.myInfoShow{display: block;}
		.myInfoHide img{width: 100%}
	</style>
	
	<body>
		
		<div class="top">
			<div class="serach flex_r_a cter">
				<img src="__ADDONSTATIC__/home/img/213.png" onclick=window.location.href="{:urlAddons('caipiao/Home/index')}" style="width: 0.5rem;height: 1rem;position: fixed;top: 0rem;left: 0rem;padding: 1rem 1rem 0.5rem 1rem;">
				<div>开奖结果查询</div>
			</div>
		</div>
		
		<div id = "refresh"  class="mui-content mui-scroll-wrapper" style="margin-top: 3rem;">
			<div class="mui-scroll">
				<div id="tips" class="myInfoHide">
					<img src="__ADDONSTATIC__/images/back.png">
				</div>
				<ul id="ul"></ul>
			</div>
		</div>
	</body>
	
	<script type="text/javascript">
		pageGlobal = 1

		function openImg(url){
			WeixinJSBridge.invoke('imagePreview', {
				'current' : url,
				'urls' : [url]
			})
		}

		mui.init({
			pullRefresh: {
				container: '#refresh',
				up:{
					auto:true,
					contentrefresh : "正在加载...",//可选，正在加载状态时，上拉加载控件上显示的标题内容
					contentnomore:'你没有更多数据了.',//可选，请求完毕若没有更多数据时显示的提醒内容；
					callback: pullupRefresh
				},
				down:{
					style:'circle',
					auto:false,
					contentrefresh : "正在刷新...",
					callback:pullfresh
				}
			}
		});
		document.querySelector('.mui-pull-bottom-pocket').style.opacity=1,
		document.querySelector('.mui-pull-bottom-pocket').style.opacity=0,
		mui('#refresh').scroll({
				indicators:false
		});
		
		function pullupRefresh() {
			getPage();
		    window.scrollTo(0, document.body.scrollHeight)
		}

		function pullfresh(){
			window.location.reload()
		}
		
		mui("#center1").pullRefresh({
		    up: {
				auto:true,
		        contentrefresh: '正在加载...',
		        callback: pullupRefresh1
		    },
		});
		mui('#center1').scroll({
			indicators:false
		});
		mui("#content1").on('tap','.qt',function(){
			$(this).click();
		});
		function getPage(){
			let param={
				page:pageGlobal,
				limit:20
			}
			$.ajax({
			    type: 'post',
			    header: 'Access-Control-Allow-Origin:*',
			    url: "{:urlAddons('caipiao/Home/pagelist')}",
			    data: JSON.stringify(param),
			    contentType: 'application/json',
			    dataType: 'json',
			    success: function (res) {
			    	let $ul = $("#ul")
			    	if(res.code === 0){
						let html = ''
						let count = res.data.length
						if(count>0){
							for(let data of res.data){
								let cashType = ''
								let mbalance = ''
								if(data.status === '中奖'){
									mbalance = data.balance
									switch (data.cash_type){
										case 0:
											cashType = '(未提现)'
											break
										case 1:
											cashType = '(已提现)'
											break
										default:
											cashType = '(?)'
											break
									}
								}
								if(data.status === '错误'){
									data.status = '图片不清晰'
								}
								html += `<li><div class="flex_c" style="padding: 0.5rem 1rem 0 1rem; font-size: 1rem; background-color: white;"><div class="flex_r_b"><div class="flex_r cter"><div style="color: #000000"><img onclick="openImg('${data.img_url}')" src="${data.img_url}" width="20" height="20"> ${data.relname}</div><div style="color: #999999;font-size: 0.8rem;margin-left: 0.5rem;">${data.mobile}</div></div><div style="color: #345fff;font-size: 0.8rem;">${data.status}${cashType}</div></div><div class="flex_r_b" style="margin-top: 0.5rem;"><div style="font-size: 0.8rem;">${data.create_time}</div><div style="color: #88bf38;">${mbalance}</div></div><div style="width: 100%;height: 0.1rem;background-color: #F5F5F5;margin-top: 0.5rem;"></div></div></li>`
							}
							$ul.append(html)
							mui('#refresh').pullRefresh().endPullupToRefresh(false);
							pageGlobal ++
						}else{
							mui('#refresh').pullRefresh().endPullupToRefresh(true);
							mui.toast('你干到底了',{ duration:'long', type:'div'})
						}
					}else{
			    		mui.toast(res.msg,{ duration:'long', type:'div'})
					}
					//判断列表是否有数据，无数据则显示提示
					let uLtext = $ul.text()
					let $tips = $('#tips')
					if(uLtext.length>0){
						$tips.removeClass('myInfoShow')
					}else{
						$tips.addClass('myInfoShow')
					}
			    },
			    error: function () {
					mui.toast('服务器异常，请稍后再试',{ duration:'long', type:'div'})
			    }
			});
		}
	</script>
</html>
